<ui:composition xmlns="http://www.w3.org/1999/xhtml"
			    xmlns:ui="http://java.sun.com/jsf/facelets"
			    xmlns:h="http://java.sun.com/jsf/html"
			    xmlns:f="http://java.sun.com/jsf/core"
			    xmlns:rich="http://richfaces.org/rich"
			    xmlns:a4j="http://richfaces.org/a4j"
			    xmlns:t="http://myfaces.apache.org/tomahawk"
			    template="/WEB-INF/layout/template.xhtml">
	
	<ui:define name="title">
		<h:outputText value="#{i18n['createEinenKunden.title']}"/>
	</ui:define>

	<ui:define name="contents">
		<h1><h:outputText id="createEinenKundenHeading" value="#{i18n['createEinenKunden.heading']}"/></h1>
		
		<h:form id="createForm">
			<a4j:region>
				<h:panelGrid id="panelGrid" columns="3" columnClasses="kundendetailsBezeichner, kundendetailsDaten">
		   			<h:outputLabel value="#{i18n['createEinenKunden.nachname']}" for="nachname"/>
					<h:inputText id="nachname"
					             value="#{kv.neuerFirmenkunde.nachname}"
					             required="true"
					             requiredMessage="#{i18n['createEinenKunden.nachname.required']}">
					    <t:validateRegExpr pattern="#{initParam.patternNachname}"
					                       message="#{i18n['error.nachnamePattern']}"/>
						<a4j:support event="onchange" ajaxSingle="true" reRender="nachname, fehlermeldungNachname"/>
					</h:inputText>
					<rich:message id="fehlermeldungNachname" for="nachname" errorClass="error">
						<f:facet name="errorMarker">
							<h:graphicImage url="/images/error.gif"/>
						</f:facet>
					</rich:message>
	
		   			<h:outputLabel value="#{i18n['createEinenKunden.vorname']}" for="vorname"/>
					<h:inputText id="vorname" value="#{kv.neuerFirmenkunde.vorname}">
						<t:validateRegExpr pattern="#{initParam.patternVorname}"
					                       message="#{i18n['error.vornamePattern']}"/>
						<a4j:support event="onchange" ajaxSingle="true" reRender="vorname, fehlermeldungVorname"/>
					</h:inputText>
					<rich:message id="fehlermeldungVorname" for="vorname" errorClass="error">
						<f:facet name="errorMarker">
							<h:graphicImage url="/images/error.gif"/>
						</f:facet>
					</rich:message>
	
					<h:outputLabel value="#{i18n['createEinenKunden.kategorie']}" for="kategorie"/>
					<rich:inputNumberSlider id="kategorie"
					                        value="#{kv.neuerFirmenkunde.kategorie}"
					                        minValue="0" maxValue="#{kv.maxKategorie}"
					                        showInput="true"
					                        inputSize="1"
					                        inputPosition="right"
					                        width="10"/>
					&#160;
									
					<h:outputLabel value="#{i18n['createEinenKunden.umsatz']}" for="umsatz"/>
					<h:inputText id="umsatz"
					             value="#{kv.neuerFirmenkunde.umsatz}"
					             required="true"
					             requiredMessage="#{i18n['createEinenKunden.umsatz.required']}">
						<f:convertNumber pattern="###,###,##0.00"/>
						<a4j:support event="onchange" ajaxSingle="true" reRender="umsatz, fehlermeldungUmsatz"/>
					</h:inputText>
					<rich:message id="fehlermeldungUmsatz" for="umsatz" errorClass="error">
						<f:facet name="errorMarker">
							<h:graphicImage url="/images/error.gif"/>
						</f:facet>
					</rich:message>
				
					<h:outputLabel value="#{i18n['createEinenKunden.seit']}" for="seit"/>
					<rich:calendar id="seit"
					               showInput="true"
					               datePattern="#{i18n['calendar.pattern']}"
					               value="#{kv.neuerFirmenkunde.seit}"/>
					&#160;
					
					<h:outputLabel value="#{i18n['createEinenKunden.email']}" for="email"/>
					<h:inputText id="email"
					             value="#{kv.neuerFirmenkunde.email}"
					             required="true"
					             requiredMessage="#{i18n['createEinenKunden.email.required']}">
						<t:validateEmail/>
						<a4j:support event="onchange" ajaxSingle="true" reRender="email, fehlermeldungEmail"/>
					</h:inputText>
					<rich:message id="fehlermeldungEmail" for="email" errorClass="error">
						<f:facet name="errorMarker">
							<h:graphicImage url="/images/error.gif"/>
						</f:facet>
					</rich:message>
	
		   			<h:outputLabel value="#{i18n['createEinenKunden.creditCard']}" for="creditCard"/>
					<h:selectOneMenu id="creditCard"
						             value="#{kv.neuerFirmenkunde.creditCard}">
						<f:selectItem itemValue="NONE" itemLabel=""/>
						<f:selectItem itemValue="AmericanExpress" itemLabel="AmericanExpress"/>
						<f:selectItem itemValue="Mastercard" itemLabel="Mastercard"/>
						<f:selectItem itemValue="VISA" itemLabel="VISA"/>
					</h:selectOneMenu> 
					&#160;
	
		   			<h:outputLabel value="#{i18n['createEinenKunden.creditCardId']}" for="creditCardId"/>
					<h:inputText id="creditCardId"
					             size="16"
					             maxlength="16"
					             value="#{kv.neuerFirmenkunde.creditCardId}">
						<t:validateCreditCard/>
						<a4j:support event="onchange" ajaxSingle="true" reRender="creditCardId, fehlermeldungCreditCardId"/>
					</h:inputText>
					<rich:message id="fehlermeldungCreditCardId" for="creditCardId" errorClass="error">
						<f:facet name="errorMarker">
							<h:graphicImage url="/images/error.gif"/>
						</f:facet>
					</rich:message>
	
		   			<h:outputLabel value="#{i18n['createEinenKunden.rabatt']}" for="rabatt"/>
					<h:inputText id="rabatt" value="#{kv.neuerFirmenkunde.rabatt}" maxlength="6" size="6">
						<f:converter converterId="javax.faces.Float"/>
						<f:validateDoubleRange minimum="0" maximum="#{kv.maxRabatt}"/>
						<a4j:support event="onchange" ajaxSingle="true" reRender="rabatt, fehlermeldungRabatt"/>
					</h:inputText>
					<rich:message id="fehlermeldungRabatt" for="rabatt" errorClass="error">
						<f:facet name="errorMarker">
							<h:graphicImage url="/images/error.gif"/>
						</f:facet>
					</rich:message>
					
					<h:outputLabel value="#{i18n['createEinenKunden.password']}" for="password"/>
					<h:inputSecret id="password"
					               value="#{kv.neuerFirmenkunde.password}"
					               redisplay="true"/>
					&#160;				
	
					<h:outputLabel value="#{i18n['createEinenKunden.passwordWdh']}" for="passwordWdh"/>
					<h:inputSecret id="passwordWdh"
					               value="#{kv.neuerFirmenkunde.password}"
					               redisplay="true">
						<t:validateEqual for="password"
						                 message="#{i18n['error.password.notEqual']}"/>
					</h:inputSecret>
					<rich:message id="fehlermeldungPassword" for="passwordWdh" errorClass="error">
						<f:facet name="errorMarker">
							<h:graphicImage url="/images/error.gif"/>
						</f:facet>
					</rich:message>
				</h:panelGrid>
			
				<p>
					<h:commandButton id="createSubmit" action="#{kv.create}" value="#{i18n['createEinenKunden.submit']}"/>
				</p>
			</a4j:region>
		</h:form>
		<rich:jQuery selector="#nachname" query="focus()"/>

		<h:outputText value="#{i18n['common.required']}"/>
	</ui:define>
</ui:composition>
